package com.hzncc.flowable_diboot.common;

import net.sf.jsqlparser.expression.Expression;
import net.sf.jsqlparser.expression.operators.relational.ExpressionList;

import java.util.Arrays;
import java.util.Collection;
import java.util.List;

/**
 * sal expression
 * <p>
 * @param <T>
 */
public class ItemsList<T extends Expression> extends ExpressionList<T> {

    public ItemsList(Collection<? extends T> expressions) {
        this.addAll(expressions);
    }

    public ItemsList(T... expressions) {
        this(Arrays.asList(expressions));
    }

    public ItemsList(List<T> expressions) {
        super(expressions);
    }

    public StringBuilder appendTo(StringBuilder builder) {
        builder.append("(");
        for(int i = 0; i < this.size(); ++i) {
            if (i > 0) {
                builder.append(", ");
            }

            builder.append(this.get(i));
        }
        builder.append(")");
        return builder;
    }
}
